<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="#">{:lang('评论列表')}</a></li>
    </ul>
    <style>tr th {
        text-align: center
    }</style>
    <form action="{:url('delMore')}" method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered text-center">
            <thead>
            <tr>
                <th width="80">
                    <button type="button" class="btn btn-info btn-sm" id="allcheck">全选</button>
                </th>
                <th>{:lang('#')}</th>
                <th>{:lang('用户昵称')}</th>
                <th>{:lang('用户头像')}</th>
                <th>{:lang('留言信息')}</th>
                <th>{:lang('时间')}</th>
                <th>{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <foreach name="datas" item="data">
                <tr>
                    <td>
                        <input type="checkbox" name="commentid[]" value="{$data.id}">
                    </td>
                    <td>{$data.id}</td>
                    <td>{$data.user_nickname}</td>
                    <td><img src="{$data.avatar}" style="width: 60px; height: 60px;"></td>
                    <td>{:mb_substr(htmlspecialchars($data['msg']),0,6)}...</td>
                    <td>{$data.time|date='Y-m-d H:i:s'}</td>
                    <td>
                        <button type="button" class="btn btn-info" onclick="seeDetail('{$data.id}')">查看详情</button>
                        <a href="{:url('del',array('id'=>$data['id']))}" class="js-ajax-delete btn btn-danger"
                           data-msg="确定删除它吗？">删除</a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
        <button type="submit" class="btn btn-danger btn-sm js-ajax-submit" onclick="return confirm('确认操作吗?')">批量删除
        </button>
    </form>
    <div class="pagination">{$commentData->render()}</div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="https://cdn.bootcss.com/layer/2.3/layer.js"></script>
<script>
    function seeDetail(param) {
        var url = "{:url('see')}";
        layer.open({
            type: 2,
            title: '查看详情',
            shadeClose: true,
            shade: false,
            maxmin: true, //开启最大化最小化按钮
            area: ['80%', '80%'],
            content: url + '?id=' + param
        });
    }

    var lock = true;
    $('#allcheck').click(function () {
        if (lock) {
            $("input[type='checkbox']").prop('checked', true);
            lock = false;
        } else {
            $("input[type='checkbox']").prop('checked', false);
            lock = true;
        }
    })
</script>
</body>
</html>